From: jenkins-bot Date: Thu, 13 Aug 2015 16:44:05 +0000 (+0000) Subject: Merge "Don't send email notifs to blocked users if $wgBlockDisablesLogin is true" X-Git-Tag: 1.31.0-rc.0~10439 X-Git-Url: http://git.cyclocoop.org/%22.%24info%5B?a=commitdiff_plain;h=02f609e06889a172c64a863481cc5f692f86e64a;hp=b672916864345746219471361fbf0f2db37ba55e;p=lhc%2Fweb%2Fwiklou.git Merge "Don't send email notifs to blocked users if $wgBlockDisablesLogin is true" --- diff --git a/includes/mail/EmailNotification.php b/includes/mail/EmailNotification.php index 0eed45034e..6c9972c8de 100644 --- a/includes/mail/EmailNotification.php +++ b/includes/mail/EmailNotification.php @@ -203,7 +203,7 @@ class EmailNotification { public function actuallyNotifyOnPageChange( $editor, $title, $timestamp, $summary, $minorEdit, $oldid, $watchers, $pageStatus = 'changed' ) { # we use $wgPasswordSender as sender's address - global $wgEnotifWatchlist; + global $wgEnotifWatchlist, $wgBlockDisablesLogin; global $wgEnotifMinorEdits, $wgEnotifUserTalk; # The following code is only run, if several conditions are met: @@ -242,12 +242,14 @@ class EmailNotification { if ( $wgEnotifWatchlist ) { // Send updates to watchers other than the current editor + // and don't send to watchers who are blocked and cannot login $userArray = UserArray::newFromIDs( $watchers ); foreach ( $userArray as $watchingUser ) { if ( $watchingUser->getOption( 'enotifwatchlistpages' ) && ( !$minorEdit || $watchingUser->getOption( 'enotifminoredits' ) ) && $watchingUser->isEmailConfirmed() && $watchingUser->getID() != $userTalkId + && !( $wgBlockDisablesLogin && $watchingUser->isBlocked() ) ) { if ( Hooks::run( 'SendWatchlistEmailNotification', array( $watchingUser, $title, $this ) ) ) { $this->compose( $watchingUser ); @@ -277,7 +279,7 @@ class EmailNotification { * @return bool */ private function canSendUserTalkEmail( $editor, $title, $minorEdit ) { - global $wgEnotifUserTalk; + global $wgEnotifUserTalk, $wgBlockDisablesLogin; $isUserTalkPage = ( $title->getNamespace() == NS_USER_TALK ); if ( $wgEnotifUserTalk && $isUserTalkPage ) { @@ -287,6 +289,8 @@ class EmailNotification { wfDebug( __METHOD__ . ": user talk page edited, but user does not exist\n" ); } elseif ( $targetUser->getId() == $editor->getId() ) { wfDebug( __METHOD__ . ": user edited their own talk page, no notification sent\n" ); + } elseif ( $wgBlockDisablesLogin && $targetUser->isBlocked() ) { + wfDebug( __METHOD__ . ": talk page owner is blocked and cannot login, no notification sent\n" ); } elseif ( $targetUser->getOption( 'enotifusertalkpages' ) && ( !$minorEdit || $targetUser->getOption( 'enotifminoredits' ) ) ) {